<include file="./Application/Admin/View/Public/htmlheader.html" />
<include file="./Application/Admin/View/Public/header.html" />
<include file="./Application/Admin/View/Public/left.html" />

<ol class="breadcrumb">
    <li><a href="/Admin">首页</a></li>
    <li class="active">直播间分类</li>
</ol>

<div class="row">
    <div class="col-lg-12">
        <div class="table-responsive">
            <table class="table table-hover table-bordered">
                <tr class="success">
                    <th>图片</th>
                    <th>分类名称</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                <volist name="categoryList" id="vo">
                    <tr id="category{$vo['id']}" class="showChild" data="parentsCategoryId{$vo['id']}" style="cursor: pointer">
                        <td><img src="{$vo.image}" width="50" /></td>
                        <td>{$vo.name}</td>
                        <td>
                            <if condition="$vo['status'] eq 1" >
                                <span class="green">启用</span>
                                <else />
                                <span class="red">禁用</span>
                            </if>

                        </td>
                        <td>{$vo.createTime}</td>
                        <td>
                            <if condition="$permission['categoryStatus'] eq TRUE">
                            <if condition="$vo['status'] eq 1">
                                <a href="__ROOT__/Admin/Room/changeStatus?categoryId={$vo['id']}&status=0" class="btn btn-default btn-xs">关闭</a>
                                <else />
                                <a href="__ROOT__/Admin/Room/changeStatus?categoryId={$vo['id']}&status=1" class="btn btn-default btn-xs">启用</a>
                            </if>
                            </if>
                            <if condition="$permission['editCategory'] eq TRUE">
                            <a href="__ROOT__/Admin/Room/editCategory?categoryId={$vo['id']}" class="btn btn-info btn-xs">修改</a>
                            </if>
                            <if condition="$permission['delCategory'] eq TRUE">
                            <if condition="$vo['child'] eq ''">
                                <a href="__ROOT__/Admin/Room/delete?categoryId={$vo['id']}" class="btn btn-danger btn-xs" onclick="return confirm('确定删除?');">删除</a>
                            </if>
                            </if>

                        </td>
                    </tr>
                    <volist name="vo['child']" id="voo">
                        <tr style="display: none; background-color: #f9f6eb" class="parentsCategoryId{$voo['categoryId']}">
                            <td><img src="/{$voo.image}" width="50" /></td>
                            <td>{$voo.name}</td>
                            <td>
                                <if condition="$voo['status'] eq 1" >
                                    <span class="green">启用</span>
                                    <else />
                                    <span class="red">禁用</span>
                                </if>

                            </td>
                            <td>{$voo.createTime}</td>
                            <td>
                                <if condition="$permission['categoryStatus'] eq TRUE">
                                    <if condition="$voo['status'] eq 1">
                                        <a href="__ROOT__/Admin/Room/changeStatus?categoryId={$voo['id']}&status=0" class="btn btn-default btn-xs">关闭</a>
                                        <else />
                                        <a href="__ROOT__/Admin/Room/changeStatus?categoryId={$voo['id']}&status=1" class="btn btn-default btn-xs">启用</a>
                                    </if>
                                </if>
                                <if condition="$permission['editCategory'] eq TRUE">
                                    <a href="__ROOT__/Admin/Room/editCategory?categoryId={$voo['id']}" class="btn btn-info btn-xs">编辑</a>
                                </if>
                                <if condition="$permission['delCategory'] eq TRUE">
                                    <a href="__ROOT__/Admin/Room/delete?categoryId={$voo['id']}" onclick="return confirm('确定删除?');" class="btn btn-danger btn-xs">删除</a>
                                </if>
                            </td>
                        </tr>
                    </volist>
                </volist>
            </table>
            <if condition="$permission['addCategory'] eq TRUE">
            <div class="row">
                <div class="col-lg-3"><button class="btn btn-primary" data-toggle="modal" data-target="#addCategory">添加分类</button></div>
            </div>
            </if>
        </div>
    </div>
</div>

<!--   添加用户 弹出层   -->
<div class="modal fade" id="addCategory" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">添加直播间</h4>
            </div>
            <form action="__ROOT__/Admin/Room/addCategory" method="post" enctype="multipart/form-data">
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-3 text-right"><p><span class="red">*</span>所属分类：</p></div>
                        <div class="col-lg-6">
                            <select class="form-control" name="parentsId">
                                <option value="0">顶级分类</option>
                                <foreach name="parentsCategoryList" item="vo">
                                    <option value="{$vo.id}">{$vo.name}</option>
                                </foreach>
                            </select>
                        </div>

                    </div>
                    <br>
                    <div class="row">
                        <div class="col-lg-3 text-right"><p><span class="red">*</span>名称：</p></div>
                        <div class="col-lg-6"><input type="text" name="name" class="form-control" /></div>
                    </div>
                    <br />
                    <div class="row">
                        <div class="col-lg-3 text-right"><p><span class="red">*</span>图片：</p></div>
                        <div class="col-lg-6"><input type="file" name="image" class="form-control" /></div>
                    </div>
                    <br />
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary" >添加</button>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(".showChild").click(function(){
        var data = $(this).attr("data");
        $("."+data+"").toggle();
    })
</script>
<include file="./Application/Admin/View/Public/footer.html" />